/**
 * MineAdmin is committed to providing solutions for quickly building web applications
 * Please view the LICENSE file that was distributed with this source code,
 * For the full copyright and license information.
 * Thank you very much for using MineAdmin.
 *
 * @Author X.Mo<root@imoi.cn>
 * @Link   https://github.com/mineadmin
 */
import type { MaFormItem } from "@mineadmin/form";
import hasAuth from "@/utils/permission/hasAuth.ts";
import MaDictSelect from "@/components/ma-dict-picker/ma-dict-select.vue";
import { concat } from "lodash-es";

export default function getFormItems(
  formType: "add" | "edit" = "add",
  t: any,
  model: any
): MaFormItem[] {
  return concat([
    {
      label: "类型",
      prop: "type",
      render: () => MaDictSelect,
      renderProps: {
        data: [
          { label: "点位", value: 1 },
          { label: "信息", value: 2 },
        ],
        placeholder: t("form.pleaseInput", { msg: "类型" }),
        clearable: true,
        multiple: false,
      },
      itemProps: {
        rules: [{ required: true, message: "请输入类型" }],
      },
    },
    {
      label: "分类名称",
      prop: "name",
      render: "input",
      renderProps: { placeholder: t("form.pleaseInput", { msg: "分类名称" }) },
      itemProps: { rules: [{ required: true, message: "请输入分类名称" }] },
    },
    {
      label: "分类描述",
      prop: "description",
      render: "input",
      renderProps: { placeholder: t("form.pleaseInput", { msg: "分类描述" }) },
    },
    {
      label: "排序",
      prop: "sort",
      render: "input",
      renderProps: { placeholder: t("form.pleaseInput", { msg: "排序" }) },
    },
    {
      label: "父级分类Id",
      prop: "parent_id",
      render: "input",
      renderProps: { placeholder: t("form.pleaseInput", { msg: "父级分类Id" }) },
    },
    {
      label: "分类层级",
      prop: "level",
      render: "input",
      renderProps: { placeholder: t("form.pleaseInput", { msg: "分类层级" }) },
    },
  ]);
}
